package com.cyp.common.result;

import lombok.Data;

@Data
public class ResultData<T> {
    private String code;
    private String message;
    private T data;

    public static <T> ResultData<T> success(T data) {
        ResultData<T> resultData = new ResultData<>();
        resultData.setCode("200");
        resultData.setMessage("success");
        resultData.setData(data);
        return resultData;
    }

    public static <T> ResultData<T> error(String code, String message) {
        ResultData<T> resultData = new ResultData<>();
        resultData.setCode(code);
        resultData.setMessage(message);
        return resultData;
    }

}
